package com.shujia.java.day15.demo1;

import java.io.FileOutputStream;

/**
* @Description: Demo2_Write
* @Author: 王火火
* @Date: 2019/8/17 10:01
 *
 * write方法写数据
 *            1. write(int )
 *            2. write(byte[] )
 *           3. write(byte[],int off,int len)
*/
public class Demo2_Write {
    public static void main(String[] args) throws Exception{
        //创建流
        FileOutputStream fis= new FileOutputStream("test.txt");
        //写入数据write(byte[] )
        //创建byte数组  100  50 方块
        byte[] bytes = new byte[]{'h','e','l','l','o','w','o','r','l','d'};
        fis.write(bytes);
        //write(byte[],int off,int len)
        // 数组  off 决定了从数组的那个位置输出, len输出几个
        fis.write(bytes,2,3);
        //关闭流
        fis.close();
    }
}
